// 全局的context，需要加的数据在这儿配置
import React from 'react'

type ContextType = {
     userInfo: Object;
     setUserInfo: React.Dispatch<React.SetStateAction<number>>;
    }
const AppContext = React.createContext<ContextType>({} as ContextType)
// 字典
interface DictItem {
  label: string,
  value: number | string,
  disabled?: boolean
}
// 用户
interface userType {
  id?: number,
  token?: string,
  userName?: string,
  avatarUrl?: string,
  sex?: number,
  phone?: string,
  type?: number,
  role?: number,
  createTime?: string,
  identityCheck?: number
}
// 账本成员
interface accountMemberType {
  id?: number
  userId?: number
  userName?: string
  accountId?: number
  initAmount?: number
  notice?: boolean
  createTime?: string
  avatarUrl?: string
  hasBindWechat?: boolean
}
// 账本
interface accountType {
  id?: number,
  createTime?: string
  createUserId?: number
  createUserName?: string
  fixedIncomeNum?: number
  fixedIncomes?: fixedIncomeType[]
  isDelete?: null
  members?: accountMemberType[]
  name?: string
  status?: number
}

// 账单
interface billType {
  accountId?: number
  accountName?: string
  amount?: number
  category?: number
  categoryName?: string
  createTime?: string
  date?: string
  id?: number
  note?: string
  payeeId?: number
  type?: number
  typeName?: string
  userId?: number
  userName?: string
}

// 固定收支
interface fixedIncomeType {
  accountId?: number
  amount?: number
  bookDate?: number
  category?: number
  createTime?: string
  cycle?: number
  id?: number
  name?: string
  type?: number
  userId?: number
  userName?: string,
  status?: number,
  // 已废弃属性
  expirationDate?: string,
  effectiveDate?: string
}
// ref测试
interface refType {
  id?: Number | null,
  name?: String,
  value?: Number,
  valPlus: () => void
}

interface categoryType {
  id?: number,
  name?: string,
  iconClass?: string,
  disabled?: number,
  accountId?: number,
  sortIndex?: number,
  useNum?: number,
  isPersonal?: number
}

// 文章
interface articleType {
  id?: number,
  title?: string,
  imgs?: string[],
  content?: string,
  userId?: number,
  secret?: 0 | 1,
  commentNum?: number,
  likeNum?: number,
  isLiked?: number,
  dislikeNum?: number,
  viewsNum?: number,
  approval?: 0 | 1 | 2,
  createTime?: string,
  editTime?: string
  avatarUrl?: string,
  userName?: string
}

// 文章评论
interface commentType {
  id?: number,
  articleId?: number,
  parentId?: number,
  content?: string,
  userId?: number,
  userName?: string,
  userAvatar?: string,
  likeNum?: number,
  isLiked?: number,
  toUserName?: string,
  editTime?: string,
  isDeleted?: number
}
// 日历日期
interface dayType {
  id?: string,
  date?: number,
  day?: number,
  currentMon?: boolean,
  data?: any
  // 农历时间
  lunarCalendar?: string
  // 1法定节假日，2法定补班，3正常假日， 4正常工作日
  status?: number
  // 假日或节气名称
  term?: string
}

export { AppContext,
   DictItem,
   userType,
   accountMemberType,
   accountType,
   billType,
   refType,
   categoryType,
   fixedIncomeType,
   articleType,
   commentType,
   dayType
  }
